<?php
class Registry extends W4eObject{
    /*
    * Default Name space
    */
    var $_defaultNameSpace = null;

    var $_registry = array();

    function __constructor($namespace = 'default', $readOnly = false ){
        $this->_defaultNameSpace = $namespace;
        $this->makeNameSpace($namespace, $readOnly);
    }

    function &getInstance($id, $namespace = 'default', $readOnly = false){
        static $instance;
        if (!isset($instance)){
            $instance = array();
        }

        if(empty($instance[$id])){
            $instances[$id] = & new Registry($namespace, $readOnly);
        }
        return $instance[$id];
    }

    function makeNameSpace($namespace, $readOnly = false){
         $this->_registry[$namespace] = array('data' => new stdClass(), 'readOnly' => $readOnly);
         return true;
    }


}
?>